From: Florian Müllner Date: Mon, 4 Nov 2013 10:14:44 +0000 (+0100) Subject: screenshot: Extend ScreenshotArea parameter validation X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3080 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f9f500490974e4bf5c4824fa596ae133995bb7ef;p=gnome-shell.git screenshot: Extend ScreenshotArea parameter validation We currently only ensure that width and height are positive, so it is still possible to pass in values that don't make any sense at all (which may even result in a crash when exceeding limits imposed by X11). There is nothing to screenshot outside the actual screen area, so restrict the parameters to that. https://bugzilla.gnome.org/show_bug.cgi?id=699752 --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 10435c5b8..73ca773a9 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -79,7 +79,9 @@ const ScreenshotService = new Lang.Class({ ScreenshotAreaAsync : function (params, invocation) { let [x, y, width, height, flash, filename, callback] = params; - if (height <= 0 || width <= 0) { + if (x < 0 || y < 0 || + width <= 0 || height <= 0 || + x + width > global.screen_width || y + height > global.screen_height) { invocation.return_error_literal(Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED, "Invalid params"); return;